<template>
  <div class="sort-arrow">
    <i class="arrow-icon el-icon-arrow-up" :class="{disabled: disabledUp}" @click="onMoveUp"></i>
    <i class="arrow-icon el-icon-arrow-down" :class="{disabled: disabledDown}" @click="onMoveDown"></i>
  </div>
</template>

<script>
export default {
  name: "SortArrow",
  props: {
    disabledUp: {
      type: Boolean,
      default: false
    },
    disabledDown: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    onMoveUp() {
      if(!this.disabledUp) {
        this.$emit('moveUp')
      }
    },
    onMoveDown() {
      if(!this.disabledDown) {
        this.$emit('moveDown')
      }
    },
  }
};
</script>

<style lang="scss" scoped>
.sort-arrow {
  display: inline-block;
  vertical-align: middle;
  .arrow-icon {
    display: block;
    padding: 2px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    &:hover {
      background-color: rgba($color: #000000, $alpha: 0.1);
    }

    &.disabled {
      cursor: not-allowed;
      color: #999;

      &:hover {
        background-color: rgba($color: #000000, $alpha: 0.01);
      }
    }
  }
}
</style>